package cn.lizemin.fakedata.utils;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * @author 李泽民
 * @Date 2024/1/20 18:41
 * @Description
 */
public class ServletUtil {

    public static HttpServletRequest getRequest() {
        ServletRequestAttributes ra = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
        assert ra != null;
        return ra.getRequest();
    }

    public static HttpSession getSession() {
        return getRequest().getSession();
    }



}
